package com.yao.controller;

import com.yao.pojo.ManageFinancial;
import com.yao.service.MoneyService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 妖悲冥
 * @date 2021/5/22 0022   -    10:12
 */
@RestController
@RequestMapping("/money")
@CrossOrigin
public class MoneyController {
    @Autowired
    MoneyService moneyService;

    @RequestMapping("/addMoney")
    public String addMoney(@RequestBody ManageFinancial financial) {
        return moneyService.addMoney(financial);
    }

    @RequestMapping("/selectMoneyOfId")
    List<ManageFinancial> selectMoneyOfId(@RequestBody ManageFinancial financial) {
        return moneyService.selectMoneyOfId(financial);
    }

    @RequestMapping("/selectAmountOfId")
    public List<List<Integer>> selectAmountOfId(@RequestBody ManageFinancial financial) {
        return moneyService.selectAmountOfId(financial.getUserId());
    }

    @RequestMapping("/selectPlayId")
    List<Integer> selectPlayId(@RequestBody ManageFinancial financial) {
        return moneyService.selectPlayId(financial.getUserId());
    }

    @RequestMapping("/selectMoneyId")
    List<Integer> selectMoneyId(@RequestBody ManageFinancial financial) {
        return moneyService.selectMoneyId(financial.getUserId());
    }
}
